package org.teststack.Test;

import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.teststack.Api.Sl.MCcc.*;
import org.teststack.Api.Sl.QykbApi;
import org.teststack.Api.Sl.SlQy;

import java.io.IOException;
import java.sql.SQLException;

public class Csyl {
    @Test


    public static void test_login_1() throws IOException, SQLException, ClassNotFoundException {//设立选择大类页
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        int res1 = SlQy.slqy();   //设立选择大类页
        int res10 = QykbApi.qykbApi();//名称申报页
        int res2 = XzqhApi.xzqhApi();//行政区划
        int res3 = ZhApi.zhApi();//名称申报字号格式验证
        int res4 = ZhApi.zhApi1();

        int res11 = XzqhApi.xzqhApi1();//行业代码输入值

        int res5 = HyApi.hyApi();//行业代码
        int res6 = XzqhApi.xzqhApi();
        int res15 = XzqhApi.xzqhApi1();
        int res7 = McYz.mcyz();    //校验申报名称
        int res14 = XzqhApi.xzqhApi1();
        int res8 = ZhApi.zhApi1();
        int res9 = McccApi.mcccApi();
//        int res20 = McccApi1.mcccApi();











//        Assert.assertEquals(res,200);
//        Assert.assertEquals(res, "登录成功");
    }

    public static void test_login_2() throws IOException {//名称申报页
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = SlQy.slqy();
            Assert.assertEquals(res, 300);
        } catch (AssertionError e) {
            System.out.println("test_login_2 failed: " + e.getMessage());
        }

//        Assert.assertEquals(res, "登录成功");
    }

    public static void test_login_3() throws IOException {//行政区划
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        int res = XzqhApi.xzqhApi();
        Assert.assertEquals(res,200);
//        Assert.assertEquals(res, "登录成功");
    }

    public void test_login_4() throws IOException {//名称申报字号格式验证
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = ZhApi.zhApi();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_4 failed: " + e.getMessage());

        }
    }


    public void test_login_5() throws IOException {//名称申报字号录入
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = ZhApi.zhApi1();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_5 failed: " + e.getMessage());
        }
    }
    public void test_login_6() throws IOException {//行业代码
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = HyApi.hyApi();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_6 failed: " + e.getMessage());
        }
    }

    public void test_login_7() throws IOException {//组织形式
    HttpClient client = new DefaultHttpClient();
    //1.根据函数返回类型、定义变更类型去接受返回值
    try {
        int res = XzqhApi.xzqhApi();
        Assert.assertEquals(res, 200);
    } catch (AssertionError e) {
        System.out.println("test_login_7 failed: " + e.getMessage());
    }
    }
    public void test_login_8() throws IOException {//校验申报名称
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = McYz.mcyz();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_8 failed: " + e.getMessage());
        }
    }
    public void test_login_9() throws IOException {//名称申报字号录入
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = ZhApi.zhApi1();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_9 failed: " + e.getMessage());
        }
    }
    public void test_login_10() throws IOException {//名称申报字号录入跳转1
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = McccApi.mcccApi();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_9 failed: " + e.getMessage());
        } catch (SQLException e) {
            throw new RuntimeException(e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
    public void test_login_11() throws IOException {//名称申报字号录入跳转2
        HttpClient client = new DefaultHttpClient();
        //1.根据函数返回类型、定义变更类型去接受返回值
        try {
            int res = McccApi.mcccApi();
            Assert.assertEquals(res, 200);
        } catch (AssertionError e) {
            System.out.println("test_login_9 failed: " + e.getMessage());
        } catch (SQLException e) {
            throw new RuntimeException(e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }






}
